Skip to content

FormLit 0.54.0: a failed start says why, and the engine cannot outlive the app on Windows - #19

Merged
nodemode-ai merged 3 commits into
mainfrom
feat/windows-start-0.54.0
Nov 20, 2026
Merged

nodemode-ai merged 3 commits into
mainfrom
feat/windows-start-0.54.0

Conversation

@nodemode-ai

Copy link
Copy Markdown
Collaborator

FormLit 0.54.0: a failed start says why, and the engine cannot outlive the app on Windows

The Windows start and stop pattern of FormTools 0.10.0, carried into FormLit: engine side and shell side.

What changes for people

  • When FormLit cannot start, it says why before it closes: the reason in a sentence, the engine's last lines, and where the engine's log is. Before, a failed start showed one fixed sentence or closed with nothing at all.
  • Quitting FormLit on Windows ends its engine and everything the engine started, also when FormLit is ended from Task Manager. On every system the engine stops by itself within a few seconds once the app that started it is gone.
  • An engine left running without its app no longer blocks the next start: the new start ends it and takes over.
  • A second FormLit on the same data folder is refused with a sentence that names the folder and the running engine.
  • Opening the engine program by itself opens FormLit, or says that FormLit is not beside it.
  • The engine keeps a log, Logs/formlit-engine.log in the data folder, with a second file for errors when it has no console.
  • FormLit waits up to two minutes for its engine, then says so. Before, it waited without end.

What was built

  • Engine: backend/app/core/startup.py is FormTools's file with FormLit's names. backend/app/core/runtime.py (new) starts the log and wraps the lock. backend/formlit_engine.py starts the log before the lock, keeps an absent standard error in a file, refuses to serve alone when frozen, holds engine.lock, and follows the process named in FORMLIT_SHELL_PID. FormLit had no engine lock and no engine log before; both belong to the frozen entry only, so development runs and the tests' engines are as they were.
  • Shell: win_job.rs is FormTools's file, unchanged. engine_start.rs is FormTools's with FormLit's names, a two minute address wait, and the engine's own data folder rule. FormLit started its engine through tauri-plugin-shell; that one start moved to std::process::Command so win_job.rs could stay unchanged. The engine is looked for where the plugin looked: beside the app's program. windows-sys 0.61.2 under the Windows target, a version the lock already held; no new crate.

How it was checked

All on Linux.

  • Engine, by hand with sleep as the stand-in app and the real entry: a second engine exit 2 with the sentence while the first kept answering; exit 0 and no lock half a second after its app was ended; a stopped engine whose app was gone replaced after five seconds; four damaged lock files and a lock naming an unrelated process replaced, that process left running; started alone with a stand-in app in each of the three install layouts exit 0 with the app opened and no lock; with no app near exit 4 and the sentence; with the three streams closed the health route answered; a data folder that cannot be made exit 5 with one sentence.
  • backend/tests/test_startup.py: 15 tests, 15 passed.
  • Shell: a scratch crate holding engine_start.rs and win_job.rs passed cargo check --target x86_64-pc-windows-msvc with no error. cargo test on Linux: 4 unit tests and 5 loop tests over read_port and engine_exit_code cut from main.rs, all passed. The hand edit of Cargo.lock equals what cargo update --workspace writes from the old lock.

Checks rehearsed (the jobs of .github/workflows/ci.yml, on a scratch copy of the commit named)

Job Command Commit Result
frontend npm ci, npm run build 43f0763 passed (inside the window rehearsal; later commits change no frontend source)
frontend npm audit --audit-level=low not run
backend python -m compileall -q app formlit_engine.py 10aec6d exit 0
backend python formlit_engine.py --selfcheck 10aec6d exit 0
backend boot with uvicorn, /api/health, /api/capabilities 10aec6d 200, 200
test python -m pytest tests -q -p no:cacheprovider 10aec6d 407 passed, 1 failed in 83.53 s (the known test_selection_models one; main had 392 passed and the same 1 failed, this branch adds 15 tests)
window python -m pytest frontend/tests/window -q -p no:cacheprovider (Playwright 1.63.0) 43f0763 12 passed
scripts bash -n on each script 10aec6d no error
scripts no em dash in markdown, no emoji release tree clean

The workflow pins Python 3.12 and Node 22; here Python was 3.13.18. The workflow has no lint step.

Not run

  • Nothing ran on Windows or macOS. No frozen engine was built: "frozen" in the checks is the entry with sys.frozen set.
  • The desktop shell was not compiled, on any system: the first compile is the release build. engine_program, start_engine, open_main, engine_failed and the start in setup were read against FormTools's, not built. win_job.rs type-checks for Windows and has never run.
  • npm audit, and the macOS and Windows build jobs of the release workflow.
  • The backend suite was not run again on the release commit itself (3dcba99): it ran on the commit before it, and the release commit changes only version fields and the CHANGELOG. The six version sites the suite compares were read and all say 0.54.0.
  • One test fails here and failed the same way on main: test_selection_models.py::test_the_recommended_models_run_on_the_cpu_provider_only. It imports onnxruntime, which is not installed in the environment used here; backend/requirements.txt pins it, so the workflow installs it. Whether the test passes there was not seen here.
  • No real agent program was run.
  • Only a Windows machine can show: that no console appears; that the failure dialog is seen before the app goes; that ending the app in Task Manager ends the engine and what it started, and that an ordinary quit leaves nothing; that a double click on the engine opens the app; that a job inside a launcher's job still takes the engine. /home/claude/form/out/test_plan/formlit.md lists these as steps.

Held

  • Bringing the first window forward at a second start needs the single-instance plugin, a new crate: left out. A second start closes with the sentence.
  • An engine left behind by 0.53.0 or older is not ended by the first start after the update: older engines wrote no lock. It keeps its address and the new engine takes another. FormPortal's cleanup or a restart removes it.
  • Packaging without a console (FORMLIT_ENGINE_WINDOWED) was not prepared.
  • The engine watches only the process named in FORMLIT_SHELL_PID; FormLit watched nothing before, so no fallback to the parent process was added.

Merge

Merge with a merge commit. Do not squash and do not rebase-merge.

… and refuses to serve alone

The family's Windows start and stop pattern, engine side, as FormTools 0.10.0 has it.

- app/core/startup.py is FormTools's file with formlit's names at its top.
- app/core/runtime.py starts Logs/formlit-engine.log in the data folder and wraps the lock.
- formlit_engine.py: the log starts before the lock; an absent standard error is kept in a
  file; a frozen engine started without its app opens the app or says one sentence (exit 4);
  a second engine on the same data folder is refused with a sentence (exit 2) while the first
  one's shell lives, and an engine whose shell is gone is ended and replaced; the engine
  leaves when the process in FORMLIT_SHELL_PID ends; a data folder that cannot be made is
  one sentence and exit 5.
- tests/test_startup.py: 15 tests with POSIX stand-ins, 15 passed here.

Seen on Linux only. Nothing ran on Windows or macOS, and no frozen engine was built.
…he app on Windows

The family's Windows start and stop pattern, shell side, as FormTools 0.10.0 has it.

- win_job.rs is FormTools's file, unchanged: the engine goes into a job object that
  Windows closes with the shell, which ends the engine and what it started.
- engine_start.rs is FormTools's file with formlit's names, a two minute address wait
  and the data folder rule of the engine (FORMLIT_DATA_DIR, else Formlit in the home
  folder).
- main.rs: the engine is started with std::process::Command in place of the shell
  plugin's sidecar call (win_job needs a Child), from the same place beside the app,
  with FORMLIT_SHELL_PID set; every failure of the start ends in one dialog with the
  sentence, the engine's last lines and the log's path, shown before the loading
  window closes; quitting ends the job on Windows before the kill.
- Cargo.toml and Cargo.lock: windows-sys 0.61.2 under the Windows target, already in
  the lock for other packages. No new crate, no single-instance plugin.

Not compiled as an app on any system. Seen here: a scratch crate holding the two
files passed cargo check for x86_64-pc-windows-msvc; cargo test on Linux, 4 unit
tests and 5 loop tests over read_port and engine_exit_code cut from main.rs, passed;
cargo update --workspace on a scratch copy of the old lock gives the lock as edited.
Moves every version site from 0.53.0 to 0.54.0: frontend/package.json,
both version fields of frontend/package-lock.json, version.ts, backend
__version__, Cargo.toml and its Cargo.lock entry, tauri.conf.json, the
README badge, the three HASHOUT_LOG headers, and the supported-versions
row of SECURITY.md (0.54.x). The CHANGELOG gains v0.54.0, dated
2026-11-19: a failed start says why, the engine ends with the app on
Windows, an engine left behind is replaced, a second start on the same
data folder is refused with a sentence, the engine opened by itself
opens the app, and the engine keeps a log.

Run before this commit, on a scratch copy of 10aec6d with the commands
of .github/workflows/ci.yml: compileall and --selfcheck exit 0; the
uvicorn boot answered /api/health and /api/capabilities; the whole
backend suite, 407 passed and 1 failed (test_selection_models, which
failed the same way on main: onnxruntime is not installed in the
environment used here); bash -n on every script. The window tests ran
on a scratch copy of 43f0763: 12 passed. Run on this tree: the em dash
and emoji check (clean) and a reading of the six version sites the
suite compares (all 0.54.0).

Not run on this tree: the suite itself (the lane was taken; no test
changed after 10aec6d and only version fields and the CHANGELOG differ),
npm audit, the type check on its own, desktop builds (the shell is not
compiled here), Windows and macOS, the real agent programs.
@nodemode-ai
nodemode-ai requested a review from gbarnai as a code owner November 20, 2026 04:40
@nodemode-ai
nodemode-ai merged commit 8de6135 into main Nov 20, 2026
5 checks passed
@nodemode-ai
nodemode-ai deleted the feat/windows-start-0.54.0 branch November 20, 2026 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant